﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;

/// <summary>
/// Administrator 的摘要说明
/// </summary>
public class Administrator : LwUser
{
	public Administrator(int g):base(g)
	{
    }
    public Administrator(string uid)
        : base(uid)
    {
    }

    public static Administrator Check()
    {
        try
        {
            LwUser lu = (LwUser)System.Web.HttpContext.Current.Session["Loginer"];
            if (lu.UserType != LwUser.AdminType)
            {
                return null;
            }
            return new Administrator(lu.Guid);
        }
        catch
        {
            return null;
        }
    }

    public static bool IsAdmin(int g)
    {
        string sql = "select UserType from Users where Guid="+g.ToString();
        object obj = Fun.GetField(sql, "UserType");
        if (obj == null)
        {
            return false;
        }
        return obj.ToString().Trim() == LwUser.AdminType;
    }
}
